#ifndef _FLASH_H
#define _FLASH_H

#include "sys_hc32f460.h"

#define F460_FLASH_SIZE 512
#define F460_SECTOR_SIZE	8192
#define F460_FLASH_BASE 0x00000000

#define BOOTLOADER_FLASH_SIZE	24*1024
#define APPLICATION_FLASH_SIZE  200*1024
#define DOWNLOAD_FLASH_SIZE		APPLICATION_FLASH_SIZE
#define APPLICATION_ADDR		BOOTLOADER_FLASH_SIZE	
#define DOWNLOAD_ADDR			(BOOTLOADER_FLASH_SIZE + APPLICATION_FLASH_SIZE)
#define DOWNLOAD_FILEINFO_ADDR	(BOOTLOADER_FLASH_SIZE + APPLICATION_FLASH_SIZE + DOWNLOAD_FLASH_SIZE)

void F460FLASH_Read(uint32_t ReadAddr,uint8_t *pBuffer,uint16_t NumToRead);
void F460FLASH_Write(uint32_t WriteAddr,uint8_t *pBuffer,uint16_t NumToWrite);
void F460FLASH_Write1(uint32_t WriteAddr,uint8_t *pBuffer,uint16_t NumToWrite);
void F460FLASH_Sector_Erase(uint32_t WriteAddr,uint32_t num);

#endif
